package com.xmjs.baselibrary.utils;

/**
 * 项目几个重要缓存数据的存取，在这个工具类里完成
 */
public class LocalCache {
    //登录令牌
    public static final String TOKEN = "token";
    //cookie
    public static final String COOKIE = "cookie";

    public static void saveToken(SP sp, String token) {
        sp.putString(TOKEN, token);
    }

    public static String getToken(SP sp) {
        return sp.getString(TOKEN, "");
    }

    public static void saveCookie(SP sp, String key) {
        sp.putString(COOKIE, key);
    }

    public static String getCookie(SP sp) {
        return sp.getString(COOKIE, "");
    }

    public static void clear(SP sp) {
        saveCookie(sp, "");
        saveToken(sp, "");
    }

}
